package com.sptpc.demo1.controller;


import com.sptpc.demo1.controller.requests.AddDrinkRequest;
import com.sptpc.demo1.model.Order;
import com.sptpc.demo1.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/order")

public class OrderControllor {
    @Autowired
    private IOrderService orderService;

    @PostMapping("/")
    public Order addNewOrder(@RequestBody AddDrinkRequest request){
        log.info("订单信息:{}",request);
        Order order = new Order();
        BeanUtils.copyProperties(request ,order);
        orderService.addOrder(order)
    }

}
